import { useUserStore } from '@/store/modules/user'

const WITHOUT_TOKEN_API = [
  { url: '/login/captcha', method: 'GET' },
  { url: '/login/doLogin', method: 'POST' },
]

export function isWithoutToken({ url, method = '' }: any) {
  return WITHOUT_TOKEN_API.some((item) => item.url === url && item.method === method.toUpperCase())
}

export function addBaseParams(params: any) {
  if (!params.userId) {
    params.userId = useUserStore().username
  }
}
